home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / pgp23src.zip / RANDOM.H < prev    next >
C/C++ Source or Header  |  1993-05-09  |  2KB  |  52 lines

  1. /*    random.h - Header include file for random.c
  2.     Last revised 15 Dec 90
  3.     (c) 1989 Philip Zimmermann.  All rights reserved.
  4. */
  5.  
  6.  
  7. #include "usuals.h"  /* typedefs for byte, word16, boolean, etc. */
  8.  
  9.  
  10. /*    Don't define PSEUDORANDOM unless you want only pseudorandom numbers.
  11.     If you do want PSEDORANDOM defined, it's better to define it right 
  12.     here in this include file because then you can be sure that all the 
  13.     files that include random.h will be properly affected. */
  14. /* #define PSEUDORANDOM */
  15.  
  16. #ifdef PSEUDORANDOM        /* use pseudorandom numbers */
  17. #define randombyte()  ((byte) pseudorand())    /* pseudorandom generator */
  18. #define randaccum_later(bitcount)        /* null function */
  19. #define randaccum(bitcount)        /* null function */
  20. #define randload(bitcount)    /* null function */
  21. #define randflush()        /* null function */
  22. #define capturecounter()    /* null function */
  23. #define keypress() kbhit()    /* TRUE iff keyboard input ready */
  24. #define getkey() getch()    /* returns data from keyboard (no echo). */
  25. #endif    /* ifdef PSEUDORANDOM */
  26.  
  27. #ifndef PSEUDORANDOM        /* use truly random numbers */
  28.  
  29. short try_randombyte(void);    /* returns truly random byte, or -1 */
  30. short randombyte(void);    /* returns truly random byte from pool */
  31.  
  32. int getstring(char *strbuf,int maxlen,boolean echo);
  33.  
  34. void randaccum_later(short bitcount);    /* get random bits later */
  35. void randaccum(short bitcount);    /* get this many raw random bits ready */
  36.  
  37. short randload(short bitcount);
  38. /* Get fresh load of raw random bits into recyclepool for key generation */
  39.  
  40. void randflush(void);    /* flush recycled random bytes */
  41.  
  42. #endif            /* ifndef PSEUDORANDOM */
  43.  
  44. /*    DJGPP includes a getkey() which works, but PGP also uses getkey() to
  45.     accumulate random bytes.  To avoid a conflict, getkey is #defined as
  46.     pgp_getkey.  You don't really need to know this. */
  47. #ifdef __GO32__
  48.     #define getkey pgp_getkey
  49. #endif
  50.  
  51. extern void flush_input(void);
  52.